home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / Effect library / Demo ƒ / Reversed fades ƒ / Halves scroll fade reversed.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-11  |  2.2 KB  |  72 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        Halves scroll fade reversed.c
  4.  
  5. Purpose:    Graphic effect to fade main window to solid pattern.
  6.             See comments below for more description.
  7.  
  8.  
  9. MSG Demo -- graphic effects demonstration program
  10. Copyright (C) 1992-4 Mark Pilgrim & Dave Blumenthal
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "msg timing.h"
  30.  
  31. #define CorrectTime 3
  32. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  33. #define theWindowWidth (boundsRect.right-boundsRect.left)
  34.  
  35. pascal short HalvesScrollFadeReversed(Rect boundsRect, Pattern *thePattern);
  36.  
  37. /* 2 regions, split down the middle of the screen.  Scroll the screen down in one
  38.    region and up in the other. */
  39.    
  40. pascal short HalvesScrollFadeReversed(Rect boundsRect, Pattern *thePattern)
  41. {
  42.     int            x;
  43.     Rect        topdest, bottomdest;
  44.     Rect        topscrollsource, bottomscrollsource;
  45.     int            cx;
  46.     int            BoxSize;
  47.     
  48.     BoxSize=theWindowHeight/25;
  49.     cx = boundsRect.left + theWindowWidth / 2;
  50.     
  51.     topscrollsource=topdest=bottomscrollsource=bottomdest=boundsRect;
  52.     topscrollsource.left=topdest.left=bottomscrollsource.right=bottomdest.right=cx;
  53.     topdest.bottom=topdest.top+BoxSize;
  54.     bottomdest.top=bottomdest.bottom-BoxSize;
  55.     
  56.     for(x = theWindowHeight - BoxSize; x >= 0; x -= BoxSize)
  57.     {
  58.         StartTiming();
  59.         ScrollRect(&topscrollsource, 0, BoxSize, 0L);
  60.         FillRect(&topdest, *thePattern);
  61.         
  62.         ScrollRect(&bottomscrollsource, 0, -BoxSize, 0L);
  63.         FillRect(&bottomdest, *thePattern);
  64.         
  65.         TimeCorrection(CorrectTime);
  66.     }
  67.     
  68.     FillRect(&boundsRect, *thePattern);
  69.     
  70.     return 0;
  71. }
  72.